<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <div> 
           <input type="text" id="input" />
           <button id="buttom"  > 计算  </button>
           

    </div>
    
    <script>

      let  inputFile=document.getElementById("input")
      let  inputButton=document.getElementById("buttom")
      inputButton.onclick=function(){
          let work=new Worker('./worker.js')
          work.postMessage(inputFile.value)
          work.onmessage=function(event){
              console.log('event')
              console.log(event.data)
              console.log('event')
          }
      }

    // var beginTime = Date.now();
	// console.log("====================");
	// console.log("====================");
	// var a = 999999;
	// var worker = new Worker("./worker.js");
	// //发送数据
	// worker.postMessage({
	// 	num: a
	// });
	// //接收worker的返回的数据
	// worker.onmessage = function(e){
	// 	console.log(e.data.result);
	// }
	// console.log("====================");
	// console.log("====================");
	// var endTime = Date.now();
	// console.log("总共用时：" + (endTime - startTime) +"毫秒");

        
    </script>

</body>

</html>